﻿using System;
using Sustainalytics.ESG.Entities;
using Sustainalytics.Synchronization.Validation.ValidationRules.Comprehensive;
using Xunit;

namespace Sustainalytics.Synchronization.Validation.Tests
{
    [Trait("Category", "Unit")]

    public class HighestControversy_should
    {
        private readonly ControversyChangeRule sut;

        public HighestControversy_should()
        {
            sut = new ControversyChangeRule();
        }

        [Fact]
        public void return_false_when_changed_from_3_to_1()
        {
            var result =
                sut.IsValid(
                    new RPControversyIndicator
                    {
                        AnswerCategory = 1,
                        Id = new Guid("A8CC9725-3F97-4EB4-ABF1-15B474296D05")
                    },
                    new RPControversyIndicator
                    {
                        AnswerCategory = 3,
                        Id = new Guid("A8CC9725-3F97-4EB4-ABF1-15B474296D05")
                    });
            Assert.False(result);
        }


        [Fact]
        public void return_false_when_changed_from_1_to_3()
        {
            var result =
                sut.IsValid(
                    new RPControversyIndicator
                    {
                        AnswerCategory = 3,
                        Id = new Guid("A8CC9725-3F97-4EB4-ABF1-15B474296D05")
                    },
                    new RPControversyIndicator
                    {
                        AnswerCategory = 1,
                        Id = new Guid("A8CC9725-3F97-4EB4-ABF1-15B474296D05")
                    });
            Assert.False(result);
        }

        [Fact]
        public void return_true_when_changed_from_1_to_2()
        {
            var result =
                sut.IsValid(
                    new RPControversyIndicator
                    {
                        AnswerCategory = 1,
                        Id = new Guid("A8CC9725-3F97-4EB4-ABF1-15B474296D05")
                    },
                    new RPControversyIndicator
                    {
                        AnswerCategory = 2,
                        Id = new Guid("A8CC9725-3F97-4EB4-ABF1-15B474296D05")
                    });
            Assert.True(result);
        }
    }
}